{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Cox"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C_SiO2 = 3.45e-08 F/cm^2\n",
      "C_TeO2 = 1.68e-06 F/cm^2\n",
      "C_tot = 3.38e-08 F/cm^2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "e_0 = 8.854e-12\n",
    "T_TeO2 = 10e-9\n",
    "T_SiO2 = 100e-9\n",
    "C_TeO2 = 19 * e_0 / T_TeO2 * 1e-4\n",
    "C_SiO2 = 3.9 * e_0 / T_SiO2 * 1e-4\n",
    "C_tot = 1 / (1 / C_TeO2 + 1 / C_SiO2)\n",
    "print(\"C_SiO2 = {:.2e} F/cm^2\".format(C_SiO2))\n",
    "print(\"C_TeO2 = {:.2e} F/cm^2\".format(C_TeO2))\n",
    "print(\"C_tot = {:.2e} F/cm^2\".format(C_tot))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Dose"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "base: 2048\\*2048, 1 us/pxl, line accumulation: 2, Time = 8.92 s;  \n",
    "base: 4096\\*4096, 1 us/pxl, line accumulation: 2, Time =  s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time = 13.38 s, Dose = 204.80 uC/cm^2\n"
     ]
    }
   ],
   "source": [
    "Resolution = 2048\n",
    "Spd = 1000/1000  ## us/pxl\n",
    "la = 3\n",
    "Size = 140 ## um, 500x=1080um, 5kx=109um\n",
    "BC = 3000/1000  ## nA\n",
    "\n",
    "Time = (Resolution/2048)**2 * Spd/1 * la/2 * 8.92\n",
    "Dose = Time * BC * 1e-9 / (Size ** 2 * 1e-8) * 1e6\n",
    "print(\"Time = {:.2f} s, Dose = {:.2f} uC/cm^2\".format(Time, Dose))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Pose"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1: posi_x = 0.01000 mm, posi_y = 10.25216 mm\n",
      "2: posi_x = -0.10900 mm, posi_y = 10.25216 mm\n",
      "3: posi_x = -0.10900 mm, posi_y = 10.51116 mm\n",
      "4: posi_x = 0.01000 mm, posi_y = 10.51116 mm\n",
      "5: posi_x = 0.01000 mm, posi_y = 10.77016 mm\n",
      "6: posi_x = -0.10900 mm, posi_y = 10.77016 mm\n",
      "7: posi_x = -0.10900 mm, posi_y = 11.02916 mm\n",
      "8: posi_x = 0.01000 mm, posi_y = 11.02916 mm\n",
      "9: posi_x = 0.01000 mm, posi_y = 11.28816 mm\n",
      "10: posi_x = -0.10900 mm, posi_y = 11.28816 mm\n",
      "11: posi_x = -0.10900 mm, posi_y = 11.54716 mm\n",
      "12: posi_x = 0.01000 mm, posi_y = 11.54716 mm\n",
      "----------------------------------------------------\n",
      "1: posi_x = 0.71000 mm, posi_y = 10.25216 mm\n",
      "2: posi_x = 0.59100 mm, posi_y = 10.25216 mm\n",
      "3: posi_x = 0.59100 mm, posi_y = 10.51116 mm\n",
      "4: posi_x = 0.71000 mm, posi_y = 10.51116 mm\n",
      "5: posi_x = 0.71000 mm, posi_y = 10.77016 mm\n",
      "6: posi_x = 0.59100 mm, posi_y = 10.77016 mm\n",
      "7: posi_x = 0.59100 mm, posi_y = 11.02916 mm\n",
      "8: posi_x = 0.71000 mm, posi_y = 11.02916 mm\n",
      "9: posi_x = 0.71000 mm, posi_y = 11.28816 mm\n",
      "10: posi_x = 0.59100 mm, posi_y = 11.28816 mm\n",
      "11: posi_x = 0.59100 mm, posi_y = 11.54716 mm\n",
      "12: posi_x = 0.71000 mm, posi_y = 11.54716 mm\n",
      "----------------------------------------------------\n",
      "1: posi_x = 1.41000 mm, posi_y = 10.25216 mm\n",
      "2: posi_x = 1.29100 mm, posi_y = 10.25216 mm\n",
      "3: posi_x = 1.29100 mm, posi_y = 10.51116 mm\n",
      "4: posi_x = 1.41000 mm, posi_y = 10.51116 mm\n",
      "5: posi_x = 1.41000 mm, posi_y = 10.77016 mm\n",
      "6: posi_x = 1.29100 mm, posi_y = 10.77016 mm\n",
      "7: posi_x = 1.29100 mm, posi_y = 11.02916 mm\n",
      "8: posi_x = 1.41000 mm, posi_y = 11.02916 mm\n",
      "9: posi_x = 1.41000 mm, posi_y = 11.28816 mm\n",
      "10: posi_x = 1.29100 mm, posi_y = 11.28816 mm\n",
      "11: posi_x = 1.29100 mm, posi_y = 11.54716 mm\n",
      "12: posi_x = 1.41000 mm, posi_y = 11.54716 mm\n"
     ]
    }
   ],
   "source": [
    "def calculate(init_posi_x, init_posi_y, channel_1, channel_2, channel_3, elec_size, gap):\n",
    "    index = 1\n",
    "    posi_x = init_posi_x\n",
    "    posi_y = init_posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    posi_x = init_posi_x - elec_size - channel_1\n",
    "    posi_y = init_posi_y\n",
    "    index = index + 1\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x - (channel_2 - channel_1) / 2\n",
    "    posi_y = posi_y + elec_size + gap\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x + elec_size + channel_2\n",
    "    posi_y = posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x + (channel_3 - channel_2) / 2\n",
    "    posi_y = posi_y + elec_size + gap\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x - elec_size - channel_3\n",
    "    posi_y = posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x\n",
    "    posi_y = posi_y + elec_size + gap\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x + elec_size + channel_3\n",
    "    posi_y = posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x - (channel_3 - channel_2) / 2\n",
    "    posi_y = posi_y + elec_size + gap\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x - elec_size - channel_2\n",
    "    posi_y = posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x + (channel_2 - channel_1) / 2\n",
    "    posi_y = posi_y + elec_size + gap\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "    index = index + 1\n",
    "    posi_x = posi_x + elec_size + channel_1\n",
    "    posi_y = posi_y\n",
    "    print(\"{}: posi_x = {:.5f} mm, posi_y = {:.5f} mm\".format(index, posi_x, posi_y))\n",
    "\n",
    "elec_size = 0.109\n",
    "gap = 0.15\n",
    "gap_2 = 0.7\n",
    "\n",
    "# mm\n",
    "channel_1 = 0.010\n",
    "channel_2 = 0.010\n",
    "channel_3 = 0.010\n",
    "\n",
    "init_posi_x = 0.01 ## -2208.93\n",
    "init_posi_y = 10.25216 ## 10252.16\n",
    "calculate(init_posi_x, init_posi_y, channel_1, channel_2, channel_3, elec_size, gap)\n",
    "\n",
    "print(\"----------------------------------------------------\")\n",
    "\n",
    "posi_x = init_posi_x + gap_2\n",
    "posi_y = init_posi_y\n",
    "calculate(posi_x, posi_y, channel_1, channel_2, channel_3, elec_size, gap)\n",
    "\n",
    "print(\"----------------------------------------------------\")\n",
    "\n",
    "posi_x = posi_x + gap_2\n",
    "posi_y = posi_y\n",
    "calculate(posi_x, posi_y, channel_1, channel_2, channel_3, elec_size, gap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "29.8538261891796"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10**(54.1/20)/10**(24.6/20)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py38",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
